package image_handler

import (
	"peilian-api/app/global/log"
	"peilian-api/app/model"
	"peilian-api/app/services/report_service"
	"peilian-api/utils/format"

	"github.com/gin-gonic/gin"
)

func ImageBeauty(ctx *gin.Context) {
	var b64d model.ImagesBase64
	// if err := bind.ShouldBinding(ctx, &b64d); err != nil {
	// 	format.NewResponseJson(ctx).Err(errors.PublicErrorCode, errors.ParamBindError)
	// 	return
	// }
	base64Data, err := new(report_service.ReportService).GetImageBeautyByBinary(ctx)
	b64d.Base64Data = base64Data
	if err != nil {
		log.Logger.ErrorF(ctx, err.Err.Error())
		format.NewResponseJson(ctx).SuccessObj(b64d)
		return
	}

	format.NewResponseJson(ctx).SuccessObj(b64d)
}

func ImageBeautyByBinary(ctx *gin.Context) {
	var b64d model.ImagesBase64
	base64Data, err := new(report_service.ReportService).GetImageBeautyByBinary(ctx)
	b64d.Base64Data = base64Data
	if err != nil {
		log.Logger.ErrorF(ctx, err.Err.Error())
		format.NewResponseJson(ctx).SuccessObj(b64d)
		return
	}
	format.NewResponseJson(ctx).SuccessObj(b64d)
}
